//
//  PropertyReparisInputInfoTableViewCell.m
//  PropertyManager
//
//  Created by TNG on 2018/7/17.
//  Copyright © 2018年 Tng. All rights reserved.
//

#import "PropertyReparisInputInfoTableViewCell.h"

@implementation PropertyReparisInputInfoTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

-(instancetype) initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self creatUI];
        self.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    return self;
}

-(void)creatUI{
    [self.contentView addSubview:self.titleLabel];
    [self.contentView addSubview:self.textfiled];
}

-(UILabel *)titleLabel
{
    if (_titleLabel == nil) {
        _titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 15, 100, 25)];
        _titleLabel.font = font(16);
        _titleLabel.textColor = SFM51;
        _titleLabel.textAlignment = NSTextAlignmentLeft;
    }
    return _titleLabel;
}

-(UITextField *)textfiled
{
    if (_textfiled == nil) {
        _textfiled = [[UITextField alloc] initWithFrame:CGRectMake(120, 15, WIDTH - 145, 25)];
        _textfiled.font = font(16);
        _textfiled.textColor = SFM51;
        [_textfiled addTarget:self action:@selector(textFiledDidChange:) forControlEvents:UIControlEventEditingChanged];
    }
    return _textfiled;
}

-(void)textFiledDidChange:(UITextField *)textfiled
{
    if (textfiled.text.length == 0) {
        return;
    }
    
    self.PropertyReparisInputInfoTableViewCellInputBlock(textfiled.text);
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
